/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package images;


import java.awt.Container;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;


/**
 *
 * @author anh
 */
public class GlamourImage {
    URL url;
    ImageIcon icon;
    
    public void addIconFor(Container con) {
        try {
            
            url = getClass().getResource("icon.png");
            icon = new ImageIcon(url);
            if (con instanceof JFrame)
                ((JFrame)con).setIconImage(icon.getImage());
            else if (con instanceof JInternalFrame)
                ((JInternalFrame)con).setFrameIcon(icon);
            else if (con instanceof JDialog)
                ((JDialog)con).setIconImage(icon.getImage());
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    }
}
